package com.itheima.d4_tcp1.ZengTcpTest;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @ClassName server
 * @Author 16799
 * @Date 2025/9/26 18:40
 * @Version 1.0
 * @Description TODO
 **/
public class server {
    public static void main(String[] args) throws Exception {
        System.out.println("-----------服务端启动----------");

        ServerSocket serverSocket = new ServerSocket(8877);
        Socket socket = serverSocket.accept();

        InputStream is = socket.getInputStream();
        DataInputStream dis = new DataInputStream(is);

        String msg = dis.readUTF();
        System.out.println(msg);

        System.out.println(socket.getRemoteSocketAddress());

        dis.close();
        socket.close();

    }
}
